/**********************************************************************
R E A D M E _ R U N . D O
**********************************************************************/

/* This do-file serves as a driver and documentation for all results used in
"Prior Work Experience and Entrepreneurship: The Careers of Young Entrepreneurs".

Author: Nicolas Gendron-Carrier
*/

**********
* SET UP *
**********
clear all
set matsize 2000
set more 1

* location for dofiles *
cd "T:\_Projet_4915\dofiles"
global dir "`c(pwd)'"
cd $dir

**************
* README_RUN *
**************

* STEP 1: Create firm panel data *
if 1 == 1 ///
{
	/* Source Data Input used:
	- `datadir'Enterprise_`y'_rl.dta (2001-2012)
	- `datadir'Connexions_`i'_`j'.dta (2001-2002 to 2011-2012) */
	
	do "gc_1_create_firm_panel.do"
}

* STEP 2: Clean cross-sectional individual data *
if 1 == 1 ///
{
	/* Source Data Input used:
	- `datadir'PC_masterfile.dta
	- `datadir'geogcor.dta 
	- `datadir'Entid_bn_`y'.dta (2001-2012) 
	- `datadir'SE_all_`y'_rl.dta (2001-2012)
	- `datadir'Individuals_`y'_`ext'.dta (2001-2012) */
	
	do "gc_2_clean_individual_datasets.do"
}

* STEP 3: Create individual panel data *
if 1 == 1 ///
{
	do "gc_3_create_individual_panel.do"
}

* STEP 4: Classify firms *
if 1 == 1 ///
{
	do "gc_4_akm.do"
	do "gc_4_firm_info.do"
}

* STEP 5: Prepare estimation samples *
if 1 == 1 ///
{
	/* Source Data Input used:
	- `datadir'PC_masterfile.dta */
	
	do "gc_5_create_estimation_sample_men_start25_occ_v1.do"
	do "gc_5_create_estimation_sample_men_start25_occ_v2.do"
}

* STEP 6: Descriptive statistics *
if 1 == 1 ///
{
	
	do "gc_6_descriptive_analysis_men.do"
}

* STEP 7: Reduced-form evidence *
if 1 == 1 ///
{
	
	do "gc_7_reduced_form_men.do"
}

* STEP 8: Structural estimation: First stage *
if 1 == 1 ///
{
	
	do "gc_8_structural_1st_stage_main.do"
	do "gc_8_structural_1st_stage_basic.do"
	do "gc_8_structural_1st_stage_alt.do"
}

* STEP 9: Structural estimation: Second stage *
if 1 == 1 ///
{
	
	do "gc_9_structural_2nd_stage_main.do"
	do "gc_9_structural_2nd_stage_basic.do"
	do "gc_9_structural_2nd_stage_alt.do"
}

* STEP 10: Model fit, full simulations *
if 1 == 1 ///
{
	
	do "gc_10_structural_fit_main.do"
	do "gc_10_structural_fit_basic.do"
	do "gc_10_structural_fit_alt.do"
	do "gc_10_structural_fit_27on.do"
}

* STEP 11: Post-estimation analysis *
if 1 == 1 ///
{
	
	do "gc_11_structural_expost.do"
}

* STEP 12: Counterfactuals *
if 1 == 1 ///
{
	
	do "gc_12_structural_counterfactuals_p2.do"
	do "gc_12_structural_counterfactuals_p3.do"
	do "gc_12_structural_counterfactuals_p2_27on.do"
	do "gc_12_structural_counterfactuals_p3_27on.do"
	do "gc_13_counterfactuals_save.do"
	do "gc_13_counterfactuals_save_27on.do"
}
